home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / procServer.h < prev    next >
C/C++ Source or Header  |  1990-10-05  |  3KB  |  92 lines

  1. /* 
  2.  *  procServer.h --
  3.  *
  4.  *    Declarations to manage pool of server processes.
  5.  *
  6.  * Copyright 1987, 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef _PROCSERVER
  17. #define _PROCSERVER
  18. #define _PROCSERVER
  19. #define _PROCSERVER
  20.  
  21. /*
  22.  * Information kept for each function that is scheduled to be called in the
  23.  * future.
  24.  */
  25. typedef struct {
  26.     void    (*func) _ARGS_((ClientData clientData,
  27.                    Proc_CallInfo *callInfoPtr));
  28.                  /* Function to call. */
  29.     ClientData        data;        /* Data to pass to function. */
  30.     Boolean        allocated;    /* TRUE => Struct was allocated by
  31.                      *         malloc. */
  32.     Timer_QueueElement    queueElement;    /* Element used to put onto timer
  33.                      * queue. */
  34. } FuncInfo;
  35.  
  36. /*
  37.  * Element of queue of pending requests for functions to be called.
  38.  */
  39. typedef struct {
  40.     void    (*func) _ARGS_((ClientData clientData,
  41.                    Proc_CallInfo *callInfoPtr));
  42.                  /* Function to call. */
  43.     ClientData    data;            /* Data to pass to function. */
  44.     FuncInfo    *funcInfoPtr;        /* Pointer to function info struct
  45.                      * that was allocated if were
  46.                      * put onto timer queue. */
  47. } QueueElement;
  48.  
  49. /*
  50.  * NUM_QUEUE_ELEMENTS    Maximum number of entries in the queue of pending
  51.  *            functions.
  52.  */
  53. #define    NUM_QUEUE_ELEMENTS    128
  54.  
  55. #define    QUEUE_EMPTY    (frontIndex == -1)
  56. #define    QUEUE_FULL    (frontIndex == nextIndex)
  57.  
  58. /*
  59.  * Information kept for each server process.
  60.  */
  61. typedef struct {
  62.     int            index;
  63.     int            flags;    /* Flags defined below. */
  64.     QueueElement    info;    /* Information to indicate next function to
  65.                  * execute. */
  66.     Sync_Condition    condition;    /* Condition to sleep on when waiting
  67.                      * for something to do. */
  68. } ServerInfo;
  69.  
  70. /*
  71.  * Flags for server info struct:
  72.  *
  73.  *    ENTRY_INUSE    There is a server process associated with this
  74.  *            entry.
  75.  *    SERVER_BUSY    The server is busy executing some command.
  76.  *    FUNC_PENDING    There is a function to execute.
  77.  */
  78. #define    ENTRY_INUSE    0x1
  79. #define    SERVER_BUSY    0x2
  80. #define    FUNC_PENDING    0x4
  81.  
  82. /*
  83.  * Number of server processes.  There have to be enough to allow for
  84.  * pageouts and block cleaning at the same time. This occurs while
  85.  * paging heavily on a file server (or with a local disk used for paging).
  86.  */
  87. #define PROC_NUM_SERVER_PROCS    (FSCACHE_MAX_CLEANER_PROCS + VM_MAX_PAGE_OUT_PROCS)
  88.  
  89. extern ServerInfo    *serverInfoTable;
  90.  
  91. #endif /* _PROCSERVER */
  92.